import 'package:dmz/base/pageWidget/base_stateful_widget.dart';
import 'package:dmz/base/widget/defult_widget.dart';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class NewsCenterWidgets {
  static garageMainTopWidget(int select, Function(int) click) {
    List<String> titles = ['故障'.tr, '告警'.tr, '通知'.tr];
    item(title, tag, select) {
      return Container(
          alignment: Alignment.center,
          width: 225.sp,
          child: Column(children: [
            Container(
                alignment: Alignment.center,
                height: 120.sp,
                child: DefaultText(title, select ? 40.sp : 28.sp,
                    textColor: select
                        ? const Color(0xFF23C565)
                        : const Color(0xFF8F8F8F),
                    fontWeight: select ? FontWeight.w700 : FontWeight.normal)),
            Container(
                height: 5.sp,
                color: select ? const Color(0xFF23C565) : Colors.transparent)
          ]));
    }

    return Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: List.generate(
                titles.length,
                (index) => item(titles[index], index, select == index)
                    .addGestureDetector(() => click(index))))
        .marginOnly(left: 32.sp, right: 32.sp);
  }

  static selectTimeWidget(String tiemStr, int tag, Function(int) click) {
    return Container(
        padding: EdgeInsets.only(left: 32.sp, right: 32.sp),
        color: const Color(0xFF434650),
        height: 154.sp,
        child: Row(children: [
          DefaultText('时效选择'.tr, 40.sp,
              textColor: const Color(0xFFF9F9F9), fontWeight: FontWeight.w700),
          const Expanded(child: SizedBox()),
          Row(children: [
            DefaultText(tiemStr, 32.sp, textColor: const Color(0xFFF9F9F9))
                .marginOnly(right: 20.sp),
            Image.asset('assets/images/home/share/right_image.png',
                width: 18.sp, height: 36.sp)
          ]).addGestureDetector(() => click(tag))
        ]));
  }
}
